FROM golang:1.19-alpine AS builder

WORKDIR /opt/app

ENV CGO_ENABLED 0
ENV GOOS linux
ENV GOPROXY https://goproxy.cn,direct

COPY go.mod .
COPY go.sum .
RUN go mod download

COPY main.go .
COPY . .
COPY resource .
COPY manifest/config/config.yaml .
COPY link.conf .
#-ldflags="-S -W"
RUN go build -o tdgui main.go

FROM alpine

WORKDIR /opt/app

ENV TZ Asia/Shanghai

COPY --from=builder /opt/app/tdgui .
COPY --from=builder /opt/app/resource ./resource
COPY --from=builder /opt/app/config.yaml .
COPY --from=builder /opt/app/link.conf .

EXPOSE 8020

CMD ["./tdgui"]